﻿using FDEEPublicFunc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FDEEMain
{
    public partial class BatchPlotCloumns : Form
    {
        public string type = "";
        public FDEE.Model.eSubType eHeightType = FDEE.Model.eSubType.None;
        public string pierParas = "";
        public string title = "";
        public BatchPlotCloumns()
        {
            InitializeComponent();
            InitType();
        }
        private void InitType()
        {

            var values = Enum.GetValues(typeof(FDEE.Model.eSubType));
            int index = 0;
           

            foreach (var item in values)
            {
                cbCHeight.Items.Add(item);
                ++index;
            }

            if (cbCHeight.Items.Count > 2)
            {
                cbCHeight.SelectedIndex = 1;
            }

            cbCSubType.DisplayMember = "name";
            values = Enum.GetValues(typeof(FDEE.Model.eColumnType));
            foreach (var item in values)
            {
                CBItem data = new CBItem();
                int tag = (int)item;
                data.name = item.ToString();
                data.tag = tag;
                cbCSubType.Items.Add(data);
            }
            if (cbCSubType.Items.Count > 2)
            {
                cbCSubType.SelectedIndex = 1;
            }
        }

        private void cbHeight_SelectedIndexChanged(object sender, EventArgs e)
        {
            string TypeName = cbCSubType.Text;
           
            FDEE.Model.eSubType type = (FDEE.Model.eSubType)cbCHeight.SelectedIndex;
            if (!string.IsNullOrWhiteSpace(TypeName))
            {
                string des = Common.GetPierHeightDes(TypeName, type);
                desCLabel.Text = des;
                desCLabel.Refresh();
               
            }
        }
        private void cbSubType_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbHeight_SelectedIndexChanged(null, null);
        }

        private void btnConfim_Click(object sender, EventArgs e)
        {
            title = cbLine.Text;
            type = cbCSubType.Text;
            eHeightType = (FDEE.Model.eSubType)cbCHeight.SelectedIndex; // 墩高分类
            if (string.IsNullOrWhiteSpace(pierPara.Text))
            {
                MessageBox.Show("请按格式输入墩柱参数", "提示");
                return;
            }
            pierParas = pierPara.Text;
            this.DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
